package com.example.kuaizu.controller;

import com.example.kuaizu.pojo.pram.CreateTalentParam;
import com.example.kuaizu.pojo.pram.GetTalentParam;
import com.example.kuaizu.pojo.pram.TalentReviewParam;
import com.example.kuaizu.pojo.pram.deliveryOliveBranchParam;
import com.example.kuaizu.service.InTalentService;
import com.example.kuaizu.utils.AjaxResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author: wangmx15
 * @date: 2025/9/18
 **/
@Log4j2
@RestController
@RequestMapping("/talent")
@RequiredArgsConstructor
public class TalentController {
    private final InTalentService talentService;

    /**
     * 创建人才
     *
     * @param req
     * @return
     */
    @PostMapping("/create")
    public AjaxResponse createTalent(@RequestBody @Validated CreateTalentParam req) {
        talentService.createTalent(req);
        return AjaxResponse.success("创建人才信息成功");
    }

    /**
     * 查询人才信息
     *
     * @param req
     * @return
     */
    @PostMapping("/getTalent")
    public AjaxResponse getTalent(@RequestBody @Validated GetTalentParam req) {
        return AjaxResponse.success("查询成功", talentService.getTalent(req));
    }

    /**
     * 查看自己的人才信息
     *
     * @return
     */
    @GetMapping("/myTalentInfo")
    public AjaxResponse myTalentInfo() {
        return AjaxResponse.success("查询成功", talentService.myTalentInfo());
    }
    /**
     * 查看自己的人才信息
     *
     * @return
     */
    @PostMapping("/delectMyTalent")
    public AjaxResponse delectMyTalent() {
        talentService.deleteMyTalent();
        return AjaxResponse.success("删除成功");
    }

    /**
     * 获取当前登陆用户橄榄枝数量
     * @return
     */
    @PostMapping("/getOliveBranch")
    public AjaxResponse getOliveBranch() {
        return AjaxResponse.success("查询成功",talentService.getOliveBranch());
    }

    /**
     * 向人才投递橄榄枝
     * @return
     */
    @PostMapping("/deliveryOliveBranch")
    public AjaxResponse deliveryOliveBranch(@RequestBody @Validated deliveryOliveBranchParam req) {
        talentService.deliveryOliveBranch(req);
        return AjaxResponse.success("邀请成功");
    }

    /**
     * 查看对自己感兴趣的项目
     * @return
     */
    @PostMapping("/getInterestedByMy")
    public AjaxResponse getInterestedByMy() {
        return AjaxResponse.success("查询成功", talentService.getInterestedByMy());
    }

    /**
     * 审核对自己感兴趣的项目
     * @return
     */
    @PostMapping("/talentReview")
    public AjaxResponse talentReview(@RequestBody @Validated TalentReviewParam req) {
        talentService.talentReview(req);
        return AjaxResponse.success("审核成功");
    }


}
